home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1997 August / Walnut Creek CDROM.7z / LISTINGS / V_12_11 / ALLISON / TSTR2.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1994-09-04  |  299 b   |  21 lines

  1. LISTING 6 - Tests string class with deep copy
  2. // tstr2.cpp
  3. #include <iostream.h>
  4. #include "str2.h"
  5.  
  6. main()
  7. {
  8.     string s("hello"), t = s;
  9.  
  10.     t[0] = 'j';
  11.     cout << "s == " << s << endl;
  12.     cout << "t == " << t << endl;
  13.     return 0;
  14. }
  15.  
  16. /* Output:
  17. s == hello
  18. t == jello
  19. */
  20.  
  21.